package com.jinmdz.fmis.dao.admin.dao;

import com.jinmdz.fmis.dao.admin.dao.provider.AdminProvider;
import com.jinmdz.fmis.dao.admin.model.admin.AdminMenuButtonListItem;
import com.jinmdz.fmis.dao.admin.model.admin.AdminMenuListItem;
import com.jinmdz.fmis.dao.admin.model.admin.AdminSystemItem;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;

import java.util.ArrayList;

/**
 * 系统平台Dao
 *
 * @author LiCongLu
 * @date 2020-03-20 10:25
 */
public interface AdminDao {

    /**
     * 为登录界面加载所有业务系统列表
     *
     * @param
     * @return
     * @author LiCongLu
     * @date 2020-03-24 15:22
     */
    @Select(" select id,system_name,system_code,disable_state,sort,remark,version " +
            " from business_system where disable_state = 0 and deleted = 0 ")
    ArrayList<AdminSystemItem> listAdminSystemForLogin();

    /**
     * 按照系统编码获取系统主键
     *
     * @param systemCode 系统编码
     * @param userId     账号主键
     * @return
     * @author LiCongLu
     * @date 2020-03-24 16:59
     */
    @SelectProvider(type = AdminProvider.class, method = "getSystemIdBySystemCode")
    @ResultType(Integer.class)
    Integer getSystemIdBySystemCode(@Param("systemCode") String systemCode, @Param("userId") Integer userId);

    /**
     * 按照帐号主键查询菜单列表
     *
     * @param systemId 系统主键
     * @param userId   帐号主键
     * @return
     * @author LiCongLu
     * @date 2020-03-20 10:58
     */
    @SelectProvider(type = AdminProvider.class, method = "listAdminMenuListByUserId")
    ArrayList<AdminMenuListItem> listAdminMenuListByUserId(@Param("systemId") Integer systemId, @Param("userId") Integer userId);

    /**
     * 按照帐号主键查询菜单按钮列表
     *
     * @param systemId 系统主键
     * @param userId   帐号主键
     * @return
     * @author LiCongLu
     * @date 2020-03-20 11:18
     */
    @SelectProvider(type = AdminProvider.class, method = "listAdminMenuButtonListByUserId")
    ArrayList<AdminMenuButtonListItem> listAdminMenuButtonListByUserId(@Param("systemId") Integer systemId, @Param("userId") Integer userId);

    /**
     * 按照菜单权限获取系统菜单主键集合
     *
     * @param systemId 系统主键
     * @param userId   帐号主键
     * @param menus    菜单路由集合
     * @return
     * @author LiCongLu
     * @date 2020-04-02 14:26
     */
    @SelectProvider(type = AdminProvider.class, method = "listAdminMenuListByMenus")
    ArrayList<AdminMenuListItem> listAdminMenuListByMenus(@Param("systemId") Integer systemId, @Param("userId") Integer userId, @Param("menus") ArrayList<String> menus);

    /**
     * 按照菜单帐号主键查询菜单按钮列表
     *
     * @param systemId 系统主键
     * @param userId   帐号主键
     * @param menus    菜单路由集合
     * @return
     * @author LiCongLu
     * @date 2020-04-02 14:50
     */
    @SelectProvider(type = AdminProvider.class, method = "listAdminMenuButtonListByMenus")
    ArrayList<AdminMenuButtonListItem> listAdminMenuButtonListByMenus(@Param("systemId") Integer systemId, @Param("userId") Integer userId, @Param("menus") ArrayList<String> menus);

}
